package com.jec.module.sysconfig.service.configor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Component;

import com.jec.module.sysconfig.dao.NumberEntryRepository;
import com.jec.module.sysconfig.entity.NumberEntry;
import com.jec.module.sysconfig.service.convertor.Convertor;
import com.jec.module.sysconfig.service.convertor.NumberEntryConvertor;

@Component
public class NumberEntryConfigor extends BaseConfigor<NumberEntry> {
	
	@Autowired
	private NumberEntryRepository numberEntryRepository;
	
	@Autowired 
	private NumberEntryConvertor numberEntryConvertor;
	
	public NumberEntryConfigor() {
		logKey = "用户数据";
	}

	@Override
	protected JpaRepository<NumberEntry, Integer> getRepository() {
		return numberEntryRepository;
	}

	@Override
	protected Convertor<NumberEntry> getConvertor() {
		return numberEntryConvertor;
	}

	@Override
	public boolean hasConfigOnNetunit(int netunit) {
		return !numberEntryRepository.findAllByNetunit(netunit).isEmpty();
	}

}
